import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { HomeIndex } from '../Home/Index'

import { HomeLeftNav } from '../Home/LeftNav'

import { AppComponent } from '../app.component';//入口文件
import{HeroesComponent} from '../xpage/heroes.component/heroes.component';

const routes: Routes = [
  // {
  //   path: '', component: AppComponent,
  // },
  {path: '',redirectTo:'/Home',pathMatch:'full'},//重定向到主页
  {path: 'login',component: HeroesComponent},//重定向到主页
  { path: 'detail/:id', loadChildren: "../xpage/hero-detail.component/hero-detail.component" },
  { path: 'heroes', loadChildren: '../xpage/heroes.component/heroes.component' },
  {
    path: 'Home',
    component: HomeIndex,
    children: [
      { path: 'HomeHeader', loadChildren: '../Home/Header' },
      { path: 'LeftNav', loadChildren: '../Home/LeftNav' }
    ]
  },
  {path:'**',redirectTo:'/Home',pathMatch:'full'}//通配符可以用来设置404页面
];
// @NgModule({
//   imports: [RouterModule.forRoot(routes)],
//   exports: [RouterModule],
// })
// export class MyRoutingModule { }
export const Routing = RouterModule.forRoot(routes);